<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>
        <ui:composition template="./TemplatePrincipal.xhtml">

            <ui:define name="top">
               
            </ui:define>

            <ui:define name="left">
               
            </ui:define>

            <ui:define name="right">
               
            </ui:define>

            <ui:define name="content">
                <h1><br><center>Lista de Autores</center></br></h1>
                
                <f:view>
                        <h:form>
                            <p:dataTable value="#{authorBean.lista}" var="item" paginator="true" rows="3">
                           
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Clave"/>
                                    </f:facet>
                                    <h:outputText value="#{item.clave}"/>
                                </p:column>
                                <p:column filterBy="#{item.nombre}">
                                    <f:facet name="header">
                                        <h:outputText value="Nombre"/>
                                    </f:facet>
                                    <h:outputText value="#{item.nombre}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="ApellidoPaterno"/>
                                    </f:facet>
                                    <h:outputText value="#{item.apellidoPaterno}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="ApellidoMaterno"/>
                                    </f:facet>
                                    <h:outputText value="#{item.apellidoMaterno}"/>
                                </p:column>
                                 <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Editar"/>
                                    </f:facet>
                                     <p:commandButton action="AutorCrearEditar" value="Editar" actionListener="#{authorBean.prepararEditar}" ajax="false">
                                         <f:setPropertyActionListener value="#{item}" target="#{authorBean.author}"/>
                                     </p:commandButton>
                                </p:column>
                                 <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Eliminar"/>
                                    </f:facet>
                                     <p:commandButton action="AutorConfirmarEliminar" value="Eliminar" actionListener="#{authorBean.prepararEliminar}" ajax="false">
                                         <f:setPropertyActionListener value="#{item}" target="#{authorBean.author}"/>
                                     </p:commandButton>
                                </p:column>
                            </p:dataTable>
                        </h:form>
                    </f:view>
                <center>  <h:form>
                     <p:commandButton action="MenuPrincipal" value="Regresar al Manu"/>
                     <p:commandButton action="AutorCrearEditar" value ="Crear nuevo" actionListener="#{authorBean.prepararNuevo}"/>
                    </h:form> </center>
            </ui:define>

        </ui:composition>

    </body>
</html>
